package innerclassDemo1;

public class Car {
    String carName;
    int carAge;
    String carColor;

    public void show(){
        System.out.println("这是外部类的show方法");
        System.out.println(carName);
        //外部类要访问内部类的成员，必须创建内部类对象
        Engine e = new Engine();
        e.engineType = "1.4T";
        e.engineAge = 3;
        System.out.println(e.engineAge);
    }

    class Engine{
        String engineType;
        int engineAge;

        public void show(){
            System.out.println("这是内部类的show方法");
            System.out.println(engineType);
            System.out.println(carAge);
        }
    }
}
